<template>
<div >
  <t-mixed-view
    style='opacity:100%'
    class='fasr_mixed_view112030'
    displayNameGridData='5555'
    title_GridData='表格标'
    :bordered_GridData='false'
    :allowSort_GridData='true'
    :tabIndex='0'
    :enableCmdCol_GridData='true'
    :optColumns='[
  {
    "ID": "ID",
    "dataField": "ID",
    "caption": "主键ID",
    "dataType": "String",
    "isShow": false,
    "groupIndex": "",
    "ExprExt": {},
    "linkFormat": "",
    "enumDisp": {},
    "hintConf": {},
    "expanded": true,
    "RefSchemaExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.ID",
    "ValueInfo_caption": {
      "ShowValue": "主键ID",
      "ReferenceExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.ID.Text",
      "Type": 0
    },
    "ValueInfo_dataType": {
      "ShowValue": "String",
      "ReferenceExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.ID.DataType",
      "Type": 0
    }
  },
  {
    "ID": "Code",
    "dataField": "Code",
    "caption": "单据编号",
    "dataType": "String",
    "isShow": true,
    "groupIndex": "",
    "ExprExt": {},
    "linkFormat": "",
    "enumDisp": {},
    "hintConf": {},
    "expanded": true,
    "RefSchemaExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.Code",
    "ValueInfo_caption": {
      "ShowValue": "单据编号",
      "ReferenceExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.Code.Text",
      "Type": 0
    },
    "ValueInfo_dataType": {
      "ShowValue": "String",
      "ReferenceExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.Code.DataType",
      "Type": 0
    }
  },
  {
    "ID": "Name",
    "dataField": "Name",
    "caption": "问题概述",
    "dataType": "String",
    "isShow": true,
    "groupIndex": "",
    "ExprExt": {},
    "linkFormat": "",
    "enumDisp": {},
    "hintConf": {},
    "expanded": true,
    "RefSchemaExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.Name",
    "ValueInfo_caption": {
      "ShowValue": "问题概述",
      "ReferenceExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.Name.Text",
      "Type": 0
    },
    "ValueInfo_dataType": {
      "ShowValue": "String",
      "ReferenceExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.Name.DataType",
      "Type": 0
    }
  },
  {
    "ID": "State",
    "dataField": "State",
    "caption": "状态",
    "dataType": "Int",
    "isShow": true,
    "groupIndex": "",
    "ExprExt": {},
    "linkFormat": "",
    "enumDisp": {},
    "hintConf": {},
    "expanded": true,
    "RefSchemaExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.State",
    "ValueInfo_caption": {
      "ShowValue": "状态",
      "ReferenceExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.State.Text",
      "Type": 0
    },
    "ValueInfo_dataType": {
      "ShowValue": "Int",
      "ReferenceExpr": "Schema.DQ.GetCDO_DO_do_projectbug_cj121801BasicList.Sources.DO_do_projectbug_cj121801.Columns.State.DataType",
      "Type": 0
    }
  }
]'

  @click="aa"
@row_click_GridData="fasr_mixed_view112030_GridData_OnRowClick"
    rowKey='ID'
    selection='single'
      :rows_GridData="LocalVars.dataGrid_DataSource"
      :loading_GridData="LocalVars.dataGrid_Loading"
      :pageIndex_GridData="LocalVars.dataGrid_PageIndex"
      :pageSize_GridData="LocalVars.dataGrid_PageSize"
      :rowsNumber_GridData="LocalVars.dataGrid_Total"
      @request_GridData="dataGrid_Request"
  >
  </t-mixed-view>
</div>
</template>

<script setup lang="ts">
import { ref, onBeforeMount, onMounted, computed, onUnmounted, reactive, nextTick, watch } from 'vue'
// import { useRouter } from 'vue-router'
// import { DataQueryClass } from '../../fas/models/DataQueryClass'
// import { DataQueryClassAsync } from '../../fas/models/DataQueryClassAsync'
// import { ActionClass } from '../../fas/models/ActionClass'
// import { ActionClassAsync } from '../../fas/models/ActionClassAsync'
// import '../../fas/dataquery/GetCDO_DO_CJ0222110030BasicList.ts'
// import '../../fas/dataquery/GetCDO_DO_do_projectbug_cj121801BasicList.ts'

const Widget =  {
  fasr_mixed_view112030 : null,
};
const PageCode = ref('Page_MixedView');
const PageID = ref('f156180b-fb5a-4e3e-86e0-bd0c4af1efa1');
const PageName = ref('Page_MixedView');
// const DataQuery = new DataQueryClass();
// DataQuery.Promise = new DataQueryClassAsync();
// const Action = new ActionClass();
// Action.Promise = new ActionClassAsync();
// const Funcs = window.Funcs;
interface LocalVariable {
}
// const router = useRouter();
const LocalVars = reactive<LocalVariable>({
  dataGrid_DataSource : [],
  dataGrid_PageIndex : 1,
  dataGrid_PageSize : 10,
  dataGrid_Total : 100,
  dataGrid_Loading : false,
});

async function Page_OnLoaded(e) {
}
async function Page_OnLoading(e) {
}
async function Page_OnError(e) {
  Funcs.HandleError(e)
}
async function fasr_mixed_view112030_GridData_OnRowClick(e) {
   alert('row-click')
}
async function aa() {
  // alert(222)
}
function fetchFromServer(_pagination, filter) {
    debugger;
    const { page, rowsPerPage, sortBy, descending, rowsNumber } = _pagination;
    const fetchCount = rowsPerPage === 0 ? rowsNumber : rowsPerPage;

    // calculate starting row of data
    const startRow = (page - 1) * rowsPerPage;

    fetch(
      `http://localhost:3004/users?_start=${startRow}&_limit=${fetchCount}`,
    ).then(response => {
      response.json().then(movies => {
        // rows.value = movies;
        // clear out existing data and add new

        LocalVars.dataGrid_DataSource.splice(
          0,
          LocalVars.dataGrid_DataSource.length,
          ...movies,
        );
        LocalVars.dataGrid_Total = 2001;
        LocalVars.dataGrid_PageIndex = page;
        LocalVars.dataGrid_PageSize = rowsPerPage;
        LocalVars.dataGrid_Loading = false;
      });
    });
  }
  async function dataGrid_Request(props) {
    debugger;
    LocalVars.dataGrid_Loading = true;
    const { page, rowsPerPage, rowsNumber } = props.pagination;
    setTimeout(() => {
      fetchFromServer(props.pagination, props.filter);
    }, 1500);
  }
async function dataGrid_cmdColClick(cmdCol)
{
      let colClicks = {
    }
    colClicks[cmdCol.text]();

}
 function dataGrid_colCommandVisible(cmdCol)
{
      let colVisibles = {
    }
    return colVisibles[cmdCol.text]();

}
onBeforeMount(()=>{
  Page_OnLoading();
})
onMounted(async ()=>{
    await nextTick();
    var props = {
        pagination : {
            page : 1,
            rowsPerPage : 10,
            rowsNumber : 100,
        }
    }
    // dataGrid_Request(props)

  Page_OnLoaded();

})
onMounted(async ()=>{
})
</script>
